﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using BLL;
namespace UI
{
    public partial class 宾客结账: Form
    {
        private TabPage tp;
        private Model.Model_ConsumerBill m;
        private string p;

        public 宾客结账()
        {
            InitializeComponent();
        }

    

        public 宾客结账(TabPage tp, ListView listView1, Model.Model_ConsumerBill m, string p)
        {
            // TODO: Complete member initialization
            this.tp = tp;
            this.listView1 = listView1;
            this.m = m;
            this.p = p;
            InitializeComponent();
        }
        string TableID;
        private void 宾客结账_Load(object sender, EventArgs e)
        {
            label2.Text = m.CBID;
            ListView li = (ListView)tp.Controls[0];
            DataRow dr = (DataRow)li.SelectedItems[0].Tag;
            TableID = dr["TableID"].ToString();
            label3.Text = dr["TableName"].ToString();
           // MessageBox.Show(BLLRoomType.CX_zd_xf(TableID).ToString());
           //查询餐桌最低消费
            object xf = BLLRoomType.CX_zd_xf(TableID);
          //  MessageBox.Show(xf.ToString());
            label14.Text = (int.Parse(p) + int.Parse(xf.ToString())).ToString();
         //   MessageBox.Show(m.VipID);
            if (m.VipID != null || m.VipID!="")
            {
               
                SqlDataReader dr_vip = BLL_Vips.CX_HY_XMDJ(m.VipID);
                while (dr_vip.Read())
                {
                    label8.Text = dr_vip["VipName"].ToString();
                    label10.Text = dr_vip["VGName"].ToString();
                    label11.Text = (double.Parse(m.CBDiscount) * 10) + "折";
                }
                dr_vip.Close();
                label15.Text = (double.Parse(label14.Text) - int.Parse(label14.Text) * double.Parse(m.CBDiscount)).ToString();
               
                label18.Text = (int.Parse(label14.Text) * double.Parse(m.CBDiscount)).ToString();

            }
            else
            {
                label18.Text = label14.Text;
            }
            

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (char.IsDigit(e.KeyChar)||e.KeyChar==8||e.KeyChar==110)
            {
               
            }
            else
            {
                e.Handled = true;

            }
           
        }

        

        
    }
}
